import java.util.HashMap;
import java.util.HashSet;

public class generateRecipes {
	private HashMap<String, Recipe> recipes = new HashMap<String, Recipe>();

	private Recipe Rep1() {
		HashSet<Predicate> initialState = new HashSet<Predicate>();
		HashSet<Predicate> goalState = new HashSet<Predicate>();

		// We initiate the initialState below.
		initialState.add(new Ingredient("Vinegar"));
		initialState.add(new Ingredient("Bean"));
		initialState.add(new Ingredient("Tomato"));
		initialState.add(new Ingredient("Lettuce"));
		initialState.add(new Ingredient("Bacon"));
		initialState.add(new Ingredient("Pasta"));
		initialState.add(new Ingredient("Salt"));
		initialState.add(new Ingredient("Pepper"));
		initialState.add(new Ingredient("Potato"));

		// goalstate
		Chopped choppedTomato = new Chopped(new Ingredient("Tomato"));
		Chopped choppedLettuce = new Chopped(new Ingredient("Lettuce"));

		Fried friedBacon = new Fried(new Ingredient("Bacon"));
		Boiled boiledPasta = new Boiled(new Ingredient("Pasta"));

		Mixed mixed = new Mixed();
		mixed.AddToList(choppedTomato);
		mixed.AddToList(choppedLettuce);
		mixed.AddToList(new Ingredient("Vinegar"));
		mixed.AddToList(new Ingredient("Bean"));

		Mixed mixed2 = new Mixed();
		mixed2.AddToList(mixed);
		mixed2.AddToList(new Ingredient("Salt"));
		mixed2.AddToList(new Ingredient("Pepper"));

		Mixed mixed3 = new Mixed();
		mixed3.AddToList(mixed2);
		mixed3.AddToList(friedBacon);
		// Initialising the goalState below.
		goalState.add(mixed3);
		goalState.add(boiledPasta);
		return new Recipe(initialState, goalState);
	}

	private Recipe Rep2() {
		/*
		 * Spaghetti Bolognese
		 */
		HashSet<Predicate> initialState = new HashSet<Predicate>();
		HashSet<Predicate> goalState = new HashSet<Predicate>();

		initialState.add(new Ingredient("Tomato"));
		initialState.add(new Ingredient("Ground Beef"));
		initialState.add(new Ingredient("Tomato Sauce"));
		initialState.add(new Ingredient("Onion"));
		initialState.add(new Ingredient("Garlic"));
		initialState.add(new Ingredient("Mushroom"));
		initialState.add(new Ingredient("Green Pepper"));
		initialState.add(new Ingredient("Oregano"));
		initialState.add(new Ingredient("Basil"));
		initialState.add(new Ingredient("Bay Leaf"));
		initialState.add(new Ingredient("Thyme"));
		initialState.add(new Ingredient("Ground Pepper"));
		initialState.add(new Ingredient("Olive Oil"));
		initialState.add(new Ingredient("Spaghetti"));
		initialState.add(new Ingredient("Parmesan Cheese"));

		Mixed mix = new Mixed();
		mix.AddToList(new Chopped(new Peeled(new Ingredient("Onion"))));
		mix.AddToList(new Chopped(new Ingredient("Mushroom")));
		mix.AddToList(new Chopped(new Ingredient("Garlic")));
		mix.AddToList(new Chopped(new Ingredient("Green Pepper")));

		Mixed mix2 = new Mixed();
		mix2.AddToList(new Fried(mix));
		mix2.AddToList(new Fried(new Ingredient("Ground Beef")));

		Mixed mix3 = new Mixed();
		mix3.AddToList(mix2);
		mix3.AddToList(new Chopped(new Ingredient("Tomato")));
		mix3.AddToList(new Ingredient("Tomato Sauce"));
		mix3.AddToList(new Ingredient("Basil"));
		mix3.AddToList(new Ingredient("Oregano"));
		mix3.AddToList(new Ingredient("Thyme"));
		mix3.AddToList(new Ingredient("Bay Leaf"));
		mix3.AddToList(new Ingredient("Ground Pepper"));

		Mixed mix4 = new Mixed();
		mix4.AddToList(new Boiled(new Ingredient("Spaghetti")));
		mix4.AddToList(new Ingredient("Olive Oil"));

		Mixed mix5 = new Mixed();
		mix5.AddToList(mix4);
		mix5.AddToList(new Ingredient("Parmesan Cheese"));

		goalState.add(new Boiled(mix3));
		goalState.add(mix5);

		return new Recipe(initialState, goalState);

	}

	private Recipe Rep3() {
		HashSet<Predicate> initialState3 = new HashSet<Predicate>();
		HashSet<Predicate> goalState3 = new HashSet<Predicate>();

		initialState3.add(new Ingredient("Tomato"));
		initialState3.add(new Ingredient("Spring Union"));
		initialState3.add(new Ingredient("Garlic"));
		initialState3.add(new Ingredient("Egg"));
		initialState3.add(new Ingredient("Sesame oil"));

		Chopped choppedTomato3 = new Chopped(new Ingredient("Tomato"));
		Chopped choppedSpringUnion3 = new Chopped(
				new Ingredient("Spring Union"));
		Chopped choppedGarlic3 = new Chopped(new Ingredient("Garlic"));
		Beaten beatenEgg3 = new Beaten(new Ingredient("Egg"));
		Fried friedEgg3 = new Fried(beatenEgg3);
		Fried friedTomato3 = new Fried(choppedTomato3);
		Mixed mixedTE = new Mixed();
		mixedTE.AddToList(friedEgg3);
		mixedTE.AddToList(friedTomato3);
		Fried friedMixedTE = new Fried(mixedTE);
		Mixed finished = new Mixed();
		finished.AddToList(friedMixedTE);
		finished.AddToList(choppedSpringUnion3);
		finished.AddToList(choppedGarlic3);
		finished.AddToList(new Ingredient("Sesame oil"));

		goalState3.add(finished);

		return new Recipe(initialState3, goalState3);
	}

	public generateRecipes() {
		// ReadFromFile...
		recipes.put("Pasta salad with bacon", this.Rep1());
		recipes.put("Spaghetti bolognese", this.Rep2());
		recipes.put("Fried Tomato and Egg", this.Rep3());
		/* Potato mix recipe */
	}

	public HashMap<String, Recipe> GetRecipes() {
		return recipes;
	}
}
